package defpackage; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.os.Parcelable; import android.text.TextUtils; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import cn.wps.moffice.OfficeApp; import cn.wps.moffice.define.VersionManager; import cn.wps.moffice.provider.MofficeFileProvider; import cn.wps.moffice.share.panel.AbsShareItemsPanel; import cn.wps.moffice_eng.R; import com.mopub.nativeads.KS2SEventNative; import defpackage.goo; import defpackage.kib; import java.io.File; import java.util.HashMap; import java.util.List; import org.eclipse.paho.client.mqttv3.internal.ClientDefaults; /* renamed from: khn reason: default package */ public final class khn { /* renamed from: khn$a */ public interface a { void a(khm khm); } private khn() { } public static void a(View view, khm khm, String str, final a aVar) { boolean z = true; boolean z2 = false; ViewGroup viewGroup = (ViewGroup) view.findViewById(R.id.link_share_child_container); if (dxh.aOH() && dxh.me(str)) { b(viewGroup, viewGroup.getContext().getString(R.string.home_share_panel_linkshare)); } if (khm == null) { if (khb.bv(OfficeApp.arx(), "com.tencent.mm")) { if (cwc.hL(str)) { final khm khm2 = khm.WECHAT; String string = view.getResources().getString(R.string.public_home_app_file_reducing); View inflate = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.public_common_share_panel_item_default, viewGroup, false); inflate.setOnClickListener(new View.OnClickListener() { /* class defpackage.khn.AnonymousClass1 */ public final void onClick(View view) { if (aVar != null) { aVar.a(khm2); } } }); ((ImageView) inflate.findViewById(R.id.share_icon)).setImageResource(R.drawable.v10_phone_public_ribbonicon_share_mm); ((TextView) inflate.findViewById(R.id.share_title)).setText(R.string.public_vipshare_wechat); ((TextView) inflate.findViewById(R.id.share_item_ext)).setText(string); inflate.findViewById(R.id.share_item_ext).setOnClickListener(null); inflate.findViewById(R.id.share_item_ext).setVisibility(0); inflate.findViewById(R.id.share_item_ext_div).setVisibility(0); inflate.findViewById(R.id.share_item_div).setVisibility(0); viewGroup.addView(inflate); } else { a(viewGroup, khm.WECHAT, (int) R.string.public_vipshare_wechat, (int) R.drawable.v10_phone_public_ribbonicon_share_mm, aVar, false); } } if (khb.gj(OfficeApp.arx()) != null) { a(viewGroup, khm.QQ, (int) R.string.public_vipshare_qq, (int) R.drawable.v10_phone_public_ribbonicon_share_qq, aVar, false); } a(viewGroup, khm.TIM, (int) R.string.public_vipshare_qq, (int) R.drawable.v10_phone_public_ribbonicon_share_tim, aVar, false); if (khb.bv(OfficeApp.arx(), "com.alibaba.android.rimet")) { a(viewGroup, khm.DING_DING, (int) R.string.phone_home_share_panel_share_to_dingding, (int) R.drawable.phone_docinfo_share_panel_dingding, aVar, false); } a(viewGroup, (khm) null, (int) R.string.public_other_share_apps, (int) R.drawable.v10_phone_public_ribbonicon_more, aVar, true); } else { if (khm == khm.WECHAT) { if (khb.bv(OfficeApp.arx(), "com.tencent.mm")) { boolean z3 = dxh.me(str) && dxh.aOH(); khm khm3 = khm.WECHAT; if (!z3) { z2 = true; } a(viewGroup, khm3, (int) R.string.public_vipshare_wechat, (int) R.drawable.v10_phone_public_ribbonicon_share_mm, aVar, z2); if (z3) { a(viewGroup, khm.WECHAT_MOMENT, khm.WECHAT_MOMENT.dem(), (int) R.drawable.v10_phone_public_ribbonicon_share_moment, aVar, true); } } } else if (khm == khm.QQ) { if (khb.gj(OfficeApp.arx()) != null) { a(viewGroup, khm.QQ, (int) R.string.public_vipshare_qq, (int) R.drawable.v10_phone_public_ribbonicon_share_qq, aVar, true); } } else if (khm == khm.TIM) { a(viewGroup, khm.TIM, (int) R.string.public_vipshare_qq, (int) R.drawable.v10_phone_public_ribbonicon_share_tim, aVar, true); } z = false; } if (z) { y((ViewGroup) view); b((ViewGroup) view, view.getContext().getString(R.string.public_more_share_way)); } } public static void a(ViewGroup viewGroup, Drawable drawable, CharSequence charSequence, Object obj, View.OnClickListener onClickListener) { a(viewGroup, drawable, charSequence, obj, false, onClickListener); } public static void a(ViewGroup viewGroup, Drawable drawable, CharSequence charSequence, Object obj, View.OnClickListener onClickListener, String str, View.OnClickListener onClickListener2) { View inflate = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.public_share_panel_ext_item, viewGroup, false); inflate.setTag(obj); inflate.setOnClickListener(onClickListener); ((ImageView) inflate.findViewById(R.id.share_icon)).setImageDrawable(drawable); ((TextView) inflate.findViewById(R.id.share_title)).setText(charSequence); ((TextView) inflate.findViewById(R.id.share_item_ext)).setText(str); inflate.findViewById(R.id.share_item_ext).setOnClickListener(onClickListener2); viewGroup.addView(inflate); } public static void a(ViewGroup viewGroup, Drawable drawable, CharSequence charSequence, Object obj, boolean z, View.OnClickListener onClickListener) { int i = 8; View inflate = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.public_common_share_panel_item_default, (ViewGroup) null); ImageView imageView = (ImageView) inflate.findViewById(R.id.share_icon); TextView textView = (TextView) inflate.findViewById(R.id.share_title); inflate.findViewById(R.id.share_item_div).setVisibility(8); View findViewById = inflate.findViewById(R.id.iv_red_tip); if (z) { i = 0; } findViewById.setVisibility(i); imageView.setImageDrawable(drawable); textView.setText(charSequence); inflate.setTag(obj); inflate.setOnClickListener(onClickListener); viewGroup.addView(inflate); } private static void a(ViewGroup viewGroup, final khm khm, int i, int i2, final a aVar) { View inflate = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.public_common_share_panel_item_horizonal, (ViewGroup) null); ((ImageView) inflate.findViewById(R.id.share_icon)).setImageResource(i2); ((TextView) inflate.findViewById(R.id.share_title)).setText(i); inflate.setOnClickListener(new View.OnClickListener() { /* class defpackage.khn.AnonymousClass4 */ public final void onClick(View view) { if (aVar != null) { aVar.a(khm); } } }); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(0, -2); layoutParams.weight = 1.0f; viewGroup.addView(inflate, layoutParams); } private static void a(ViewGroup viewGroup, final khm khm, int i, int i2, final a aVar, boolean z) { View inflate = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.public_common_share_panel_item_default, (ViewGroup) null); ImageView imageView = (ImageView) inflate.findViewById(R.id.share_icon); TextView textView = (TextView) inflate.findViewById(R.id.share_title); inflate.findViewById(R.id.share_item_div).setVisibility(z ? 8 : 0); imageView.setImageResource(i2); textView.setText(i); inflate.setOnClickListener(new View.OnClickListener() { /* class defpackage.khn.AnonymousClass2 */ public final void onClick(View view) { if (aVar != null) { aVar.a(khm); } } }); viewGroup.addView(inflate); } public static void a(String str, View view, final a aVar, View.OnClickListener onClickListener) { LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.link_share_child_container); linearLayout.setOrientation(0); View findViewById = view.findViewById(R.id.title_container); findViewById.setVisibility(0); TextView textView = (TextView) findViewById.findViewById(R.id.title); if (!dxh.aOH() || !dxh.me(str)) { textView.setText(R.string.public_share_to); } else { textView.setText(R.string.home_share_panel_linkshare); } view.findViewById(R.id.title_container).setVisibility(0); if (VersionManager.aYQ()) { int i = 3; a(linearLayout, khm.WECHAT, (int) R.string.infoflow_share_wx, (int) R.drawable.v10_phone_public_ribbonicon_share_mm, aVar); if (khb.gj(OfficeApp.arx()) != null) { a(linearLayout, khm.QQ, (int) R.string.infoflow_share_qq, (int) R.drawable.v10_phone_public_ribbonicon_share_qq, aVar); i = 4; } a(linearLayout, khm.TIM, (int) R.string.infoflow_share_tim, (int) R.drawable.v10_phone_public_ribbonicon_share_tim, aVar); if (khb.bv(OfficeApp.arx(), "com.alibaba.android.rimet")) { a(linearLayout, khm.DING_DING, (int) R.string.public_dingding, (int) R.drawable.phone_docinfo_share_panel_dingding, aVar); i++; } if (i < 5 && glw.bRg()) { a(linearLayout, khm.TRANSFER_FILE_TO_PC, (int) R.string.infoflow_share_sendtopc, (int) R.drawable.component_send_to_pc_share_and_send_icon, new a() { /* class defpackage.khn.AnonymousClass3 */ @Override // defpackage.khn.a public final void a(khm khm) { glv.wt("share_send_pc"); aVar.a(khm); } }); } a(linearLayout, (khm) null, (int) R.string.public_more, (int) R.drawable.v10_phone_public_ribbonicon_more, aVar); if (cwc.hL(str)) { View findViewById2 = view.findViewById(R.id.file_size_reduce); findViewById2.setVisibility(0); findViewById2.setOnClickListener(onClickListener); return; } return; } a(linearLayout, khm.MAIL, (int) R.string.public_share_email, (int) R.drawable.v10_phone_public_ribbonicon_share_email, aVar); a(linearLayout, khm.CLOUD_STORAGE, (int) R.string.documentmanager_open_storage, (int) R.drawable.v10_phone_public_icon_share_cloud, aVar); a(linearLayout, khm.WHATSAPP, (int) R.string.public_whatsapp, (int) R.drawable.public_panel_share_whatsapp_ribbonicon, aVar); boolean avN = cwl.avN(); boolean bv = khb.bv(OfficeApp.arx(), "jp.naver.line.android"); if (avN && bv) { a(linearLayout, khm.LINE, (int) R.string.public_line, (int) R.drawable.public_panel_share_line_ribbonicon, aVar); } a(linearLayout, (khm) null, (int) R.string.public_more, (int) R.drawable.v10_phone_public_ribbonicon_more, aVar); } public static boolean a(Context context, final String str, khm khm) { Parcelable a2; Uri a3; boolean z = false; if (!b(khm) && !c(khm)) { return false; } if (khm == khm.MAIL) { bP(context, str); return true; } else if (khm == khm.CLOUD_STORAGE) { gct.f(context, str, null); return true; } else if (khm == khm.TRANSFER_FILE_TO_PC) { new glw().a((Activity) context, gnv.wL(str)); return true; } else if (khm == khm.QQ) { String gj = khb.gj(context); if (gj == null) { lvg.d(context, R.string.documentmanager_nocall_share, 0); } else { Intent Gk = khb.Gk(str); if (lud.isAndroidN()) { a3 = MofficeFileProvider.bN(context, str); Gk.addFlags(3); if (a3 != null && khl.Gn(gj)) { context.grantUriPermission(gj, a3, 3); } } else { a3 = cxe.a(new File(str), OfficeApp.arx()); } Gk.putExtra("android.intent.extra.SUBJECT", context.getResources().getString(R.string.public_share)); Gk.putExtra("android.intent.extra.STREAM", a3); Gk.putExtra("pkg_name", context.getPackageName()); Gk.setClassName(gj, khm.QQ.mcR); context.startActivity(Gk); } return true; } else if (khm == khm.LINE) { lwp.cd(context, str); return true; } else { Intent Gk2 = khb.Gk(str); if (lud.isAndroidN()) { Uri bN = MofficeFileProvider.bN(context, str); Gk2.addFlags(3); context.grantUriPermission(khm.packageName, bN, 3); a2 = bN; } else { a2 = cxe.a(new File(str), OfficeApp.arx()); } final Activity activity = (Activity) context; if (khm.mcR.equals("com.tencent.mm.ui.tools.ShareImgUI") && dxh.me(str)) { z = goo.b(activity, str, new Runnable() { /* class defpackage.khn.AnonymousClass7 */ public final void run() { goo.bSl().a(activity, "android_vip_cloud_docsize_limit", "cloudshare", new goo.a() { /* class defpackage.khn.AnonymousClass7.AnonymousClass1 */ @Override // defpackage.goo.a public final void oi(boolean z) { if (z) { new khr(activity, str, khm.WECHAT).den(); } } }); } }, new Runnable() { /* class defpackage.khn.AnonymousClass8 */ public final void run() { new khr(activity, str, khm.WECHAT).den(); } }); } if (z) { return true; } Gk2.putExtra("android.intent.extra.SUBJECT", context.getResources().getString(R.string.public_share)); Gk2.putExtra("android.intent.extra.STREAM", a2); Gk2.putExtra("pkg_name", context.getPackageName()); Gk2.setClassName(khm.packageName, khm.mcR); if (khm == khm.WECHAT || khm == khm.WECHAT_MOMENT) { ((Activity) context).startActivityForResult(Gk2, 2302753); } else { context.startActivity(Gk2); } return true; } } public static void b(ViewGroup viewGroup, String str) { View inflate = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.share_item_tag, viewGroup, false); ((TextView) inflate.findViewById(R.id.tag_name)).setText(str); viewGroup.addView(inflate); } public static boolean b(khm khm) { if (khm == null) { return false; } return khm == khm.CLOUD_STORAGE || khm == khm.MAIL || khm == khm.TRANSFER_FILE_TO_PC; } public static void bP(final Context context, final String str) { kib.b(context, new kib.e() { /* class defpackage.khn.AnonymousClass5 */ @Override // defpackage.kib.e public final void b(ResolveInfo resolveInfo) { lvq.a(resolveInfo, context, String.format("'%s'", lwv.IR(str)), str, "share_template_sub"); } }); } public static void bQ(Context context, final String str) { czq czq = null; AnonymousClass6 r6 = new AbsShareItemsPanel.a() { /* class defpackage.khn.AnonymousClass6 */ @Override // cn.wps.moffice.share.panel.AbsShareItemsPanel.a public final boolean b(khj khj) { if ((khj instanceof khi) && "share.pc".equals(((khi) khj).cjL)) { glv.wt("share_more_list_send_pc"); } if (khj == null || TextUtils.isEmpty(khj.getText())) { return false; } HashMap hashMap = new HashMap(); if (OfficeApp.arx().cqA.gI(str)) { hashMap.put("as", "pdf"); } else { hashMap.put("as", KS2SEventNative.SCHEME_FILE); } hashMap.put("to", khj.getText().toLowerCase()); djq.l("feature_share", hashMap); return false; } }; AbsShareItemsPanel<String> a2 = kha.a(context, str, null, true, false, 3); if (a2 != null) { a2.setItemShareIntercepter(r6); czq = kha.b(context, a2); a2.setOnItemClickListener( /* JADX ERROR: Method code generation error jadx.core.utils.exceptions.CodegenException: Error generate insn: 0x0023: INVOKE (r0v1 'a2' cn.wps.moffice.share.panel.AbsShareItemsPanel<java.lang.String>) (wrap: kha$4 : 0x0020: CONSTRUCTOR (r1v1 kha$4) = (r2v1 'czq' czq) call: kha.4.<init>(czq):void type: CONSTRUCTOR) type: VIRTUAL call: cn.wps.moffice.share.panel.AbsShareItemsPanel.setOnItemClickListener(cn.wps.moffice.share.panel.AbsShareItemsPanel$b):void in method: khn.bQ(android.content.Context, java.lang.String):void, file: classes.dex at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:255) at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:217) at jadx.core.codegen.RegionGen.makeSimpleBlock(RegionGen.java:110) at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:56) at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:93) at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:59) at jadx.core.codegen.RegionGen.makeRegionIndent(RegionGen.java:99) at jadx.core.codegen.RegionGen.makeIf(RegionGen.java:143) at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:63) at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:93) at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:59) at jadx.core.codegen.MethodGen.addRegionInsns(MethodGen.java:244) at jadx.core.codegen.MethodGen.addInstructions(MethodGen.java:237) at jadx.core.codegen.ClassGen.addMethodCode(ClassGen.java:342) at jadx.core.codegen.ClassGen.addMethod(ClassGen.java:295) at jadx.core.codegen.ClassGen.lambda$addInnerClsAndMethods$2(ClassGen.java:264) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395) at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) Caused by: jadx.core.utils.exceptions.CodegenException: Error generate insn: 0x0020: CONSTRUCTOR (r1v1 kha$4) = (r2v1 'czq' czq) call: kha.4.<init>(czq):void type: CONSTRUCTOR in method: khn.bQ(android.content.Context, java.lang.String):void, file: classes.dex at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:255) at jadx.core.codegen.InsnGen.addWrappedArg(InsnGen.java:119) at jadx.core.codegen.InsnGen.addArg(InsnGen.java:103) at jadx.core.codegen.InsnGen.generateMethodArguments(InsnGen.java:806) at jadx.core.codegen.InsnGen.makeInvoke(InsnGen.java:746) at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:367) at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:249) ... 19 more Caused by: jadx.core.utils.exceptions.JadxRuntimeException: Expected class to be processed at this point, class: kha, state: GENERATED_AND_UNLOADED at jadx.core.dex.nodes.ClassNode.ensureProcessed(ClassNode.java:215) at jadx.core.codegen.InsnGen.makeConstructor(InsnGen.java:630) at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:363) at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:230) ... 25 more */ /* r2 = 0 khn$6 r6 = new khn$6 r6.<init>(r8) r3 = 1 r4 = 0 r5 = 3 r0 = r7 r1 = r8 cn.wps.moffice.share.panel.AbsShareItemsPanel r0 = defpackage.kha.a(r0, r1, r2, r3, r4, r5) if (r0 != 0) goto L_0x0017 L_0x0011: if (r2 == 0) goto L_0x0016 r2.show() L_0x0016: return L_0x0017: r0.setItemShareIntercepter(r6) czq r2 = defpackage.kha.b(r7, r0) kha$4 r1 = new kha$4 r1.<init>(r2) r0.setOnItemClickListener(r1) goto L_0x0011 */ throw new UnsupportedOperationException("Method not decompiled: defpackage.khn.bQ(android.content.Context, java.lang.String):void"); } public static boolean c(khm khm) { if (khm == null) { return false; } OfficeApp arx = OfficeApp.arx(); if (khm == khm.TIM && !khb.bv(arx, khm.packageName)) { gn(arx); return false; } else if (khm == khm.QQ && khb.gj(arx) == null) { lvg.d(arx, R.string.documentmanager_nocall_share, 0); return false; } else if (khb.bv(arx, khm.packageName)) { return true; } else { lvg.d(arx, R.string.documentmanager_nocall_share, 0); return false; } } public static boolean gk(Context context) { return khb.bv(context, "com.tencent.mobileqq") || khb.bv(context, "com.tencent.mobileqqi") || khb.bv(context, "com.tencent.qqlite") || khb.bv(context, "com.tencent.minihd.qq") || khb.bv(context, "com.tencent.qq.kddi"); } public static boolean gl(Context context) { return khb.bv(context, "com.tencent.tim"); } public static boolean gm(Context context) { return khb.bv(context, "com.tencent.mm"); } public static void gn(Context context) { goq.j("share_tim_download", null, true); Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("https://office.qq.com/mobile/index.html?adtag=fromWPS")); intent.addFlags(ClientDefaults.MAX_MSG_SIZE); if (intent.resolveActivity(context.getPackageManager()) != null) { context.startActivity(intent); } else { lvg.d(context, R.string.public_error, 0); } } public static boolean go(Context context) { List<ResolveInfo> dea = khb.dea(); boolean z = (dea == null || dea.size() == 0) ? false : true; if (!z) { lvg.a(context, context.getString(R.string.documentmanager_noEmailApp), 0); } return z; } public static void x(ViewGroup viewGroup) { View view = new View(viewGroup.getContext()); view.setBackgroundResource(R.color.v10_phone_public_panel_list_item_divide_line_color); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, 1); int dimensionPixelSize = viewGroup.getContext().getResources().getDimensionPixelSize(R.dimen.phone_ppt_panel_content_left_right_space) + ((int) TypedValue.applyDimension(1, 34.0f, viewGroup.getContext().getResources().getDisplayMetrics())); layoutParams.setMargins(dimensionPixelSize, 0, 0, 0); if (Build.VERSION.SDK_INT >= 17) { layoutParams.setMarginStart(dimensionPixelSize); layoutParams.setMarginEnd(0); } viewGroup.addView(view, layoutParams); } public static void y(ViewGroup viewGroup) { View view = new View(viewGroup.getContext()); view.setBackgroundResource(R.color.v10_phone_public_panel_divide_view_color); viewGroup.addView(view, new LinearLayout.LayoutParams(-1, luf.dip2px(viewGroup.getContext(), 8.0f))); } }